[WIP] 3482 Add detection for circular macro replacement#4029
Open
Nic-Ma wants to merge 7 commits intoProject-MONAI:devfrom
Open
[WIP] 3482 Add detection for circular macro replacement#4029Nic-Ma wants to merge 7 commits intoProject-MONAI:devfrom
Nic-Ma wants to merge 7 commits intoProject-MONAI:devfrom
Conversation
merge master
merge master
merge master
merge master
merge master
Signed-off-by: Nic Ma <nma@nvidia.com>
Contributor
Author
|
/black |
Contributor
Author
|
/build |
1 similar comment
Contributor
Author
|
/build |
Signed-off-by: Nic Ma <nma@nvidia.com>
Contributor
Author
|
/build |
ericspod
reviewed
Mar 31, 2022
|
|
||
| """ | ||
| if waiting_list is None: | ||
| waiting_list = set() |
Member
There was a problem hiding this comment.
If waiting_list is actually a list we could look at the previous item in the exception to help the user trace what's happened.
Contributor
Author
Contributor
There was a problem hiding this comment.
i think set is more suitable/efficient for in checks here...not sure if the previous item is very intuitive when the circular ref is formed by multiple reference a->b->...->c->a
ericspod
reviewed
Mar 31, 2022
| if not path: | ||
| # if the target id is in the waiting list, that's circular references | ||
| if ids in waiting_list: | ||
| raise ValueError(f"detected circular references in macro replacement '{ids}' for id='{id}'.") |
Member
There was a problem hiding this comment.
So this would be raise ValueError(f"Detected circular references in macro replacement '{ids}' for id='{id}'. (previous id='{waiting_list[-2]}'") or something like that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
part of #3482
Description
Thanks for Gigon's suggestion, this PR added support to detect circular macro replacement in a config file.
And it also fixed a bug that missing the
idarg in recursive operation, and now we don't do recursive logic for the case that macro text is in another config file.Added many unit tests to cover the cases.
Status
Working in progress
Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests --disttests.make htmlcommand in thedocs/folder.